/*******************************************************************
 *
 * Copyright (C), 2021-2022, Letstrong, All rights reserved.
 *
 * Author      : 
 * Create Time : 2020-12-14
 * Version     : v0.1
 * Description : 
 *******************************************************************/
#ifndef _OTA_H_
#define _OTA_H_

/*----------------------------Head file----------------------------*/
#include "rwip_config.h"
#include "rwprf_config.h"

#if (BLE_OTA_SERVER)
#include "ota_task.h"
#include "atts.h"
#include "prf_types.h"
#include "prf.h"

/*----------------------------macro file---------------------------*/
#define OTA_MANDATORY_MASK       (0xFFFF)

/*----------------------------type define--------------------------*/
/// OTA service Attributes Indexes // 
enum
{
    OTA_IDX_SVC = 0,
	///*************************  refer nordic OTA design  ******************///
	OTA_IDX_CTRL_POINT_CHAR, 
	OTA_IDX_CTRL_POINT_VAL,
	OTA_IDX_CTRL_POINT_NTF_CFG,

	OTA_IDX_PACKET_CHAR,  
	OTA_IDX_PACKET_VAL,

	OTA_IDX_VERSION_CHAR,  
	OTA_IDX_VERSION_VAL,

	OTA_IDX_NB,
	///**************************************************************************///
};

/// OTA 'Profile' Server environment variable
struct ota_env_tag
{
	/// profile environment
	prf_env_t prf_env;
	/// On-going operation
	struct ke_msg * operation;
	///  Services Start Handle
	uint16_t start_hdl; 
	/// OTA task state
	ke_state_t state[OTA_IDX_MAX];
	/// Notification configuration of peer devices.
	uint16_t ctrl_point_ntf_cfg[BLE_CONNECTION_MAX];
	/// Database features
	uint8_t features;
};

/*----------------------------var define---------------------------*/							

/*-------------------------func declaration------------------------*/
const struct prf_task_cbs* ota_prf_itf_get(void);
extern void ota_ctrl_point_notify(struct ota_ctrl_point_ntf const *param);

/*-----------------------------------------------------------------*/
	
#endif /* #if (BLE_OADS_SERVER) */

#endif /*  _OTA_H_ */





